package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepModelDeployMapper;
import com.ruoyi.deeplearn.domain.DeepModelDeploy;
import com.ruoyi.deeplearn.service.IDeepModelDeployService;

/**
 * 模型部署Service业务层处理
 * 
 * @author 任伟伟
 * @date 2022-12-10
 */
@Service
public class DeepModelDeployServiceImpl implements IDeepModelDeployService 
{
    @Autowired
    private DeepModelDeployMapper deepModelDeployMapper;

    /**
     * 查询模型部署
     * 
     * @param id 模型部署主键
     * @return 模型部署
     */
    @Override
    public DeepModelDeploy selectDeepModelDeployById(Long id)
    {
        return deepModelDeployMapper.selectDeepModelDeployById(id);
    }

    /**
     * 查询模型部署列表
     * 
     * @param deepModelDeploy 模型部署
     * @return 模型部署
     */
    @Override
    public List<DeepModelDeploy> selectDeepModelDeployList(DeepModelDeploy deepModelDeploy)
    {
        return deepModelDeployMapper.selectDeepModelDeployList(deepModelDeploy);
    }

    /**
     * 新增模型部署
     * 
     * @param deepModelDeploy 模型部署
     * @return 结果
     */
    @Override
    public int insertDeepModelDeploy(DeepModelDeploy deepModelDeploy)
    {
        deepModelDeploy.setId(IdUtil.getSnowflakeNextId());
        deepModelDeploy.setCreateTime(DateUtils.getNowDate());
        return deepModelDeployMapper.insertDeepModelDeploy(deepModelDeploy);
    }

    /**
     * 修改模型部署
     * 
     * @param deepModelDeploy 模型部署
     * @return 结果
     */
    @Override
    public int updateDeepModelDeploy(DeepModelDeploy deepModelDeploy)
    {
        deepModelDeploy.setUpdateTime(DateUtils.getNowDate());
        return deepModelDeployMapper.updateDeepModelDeploy(deepModelDeploy);
    }

    /**
     * 批量删除模型部署
     * 
     * @param ids 需要删除的模型部署主键
     * @return 结果
     */
    @Override
    public int deleteDeepModelDeployByIds(Long[] ids)
    {
        return deepModelDeployMapper.deleteDeepModelDeployByIds(ids);
    }

    /**
     * 删除模型部署信息
     * 
     * @param id 模型部署主键
     * @return 结果
     */
    @Override
    public int deleteDeepModelDeployById(Long id)
    {
        return deepModelDeployMapper.deleteDeepModelDeployById(id);
    }
}
